.nf
                                             Appendix D

                              The Microcomputer Development System-800 Cold Start Loader for CP/M 2



  1                                title   mds cold start loader at 3000h'
  2                       ;
  3                       ;        mds-800 cold start loader for cp/m 2.0
  4                       ;
  5                       ;        version 2.0 august, 1979
  6                       ;
  7      0000 =           false    equ     0
  8      ffff             true     equ     not false
  9      0000 =           testing  equ     false    if true, then go to mon80 on errors
 10                       ;
 11                                if      testing
 12                       bias     equ     03400h
 13                                endif
 14                                if      not testing
 15      0000 =           bias     equ     0000h
 16                                endif
 17      0000 =           cpmb     equ     bias          ;base of dos load
 18      0806 =           bdos     equ     806h+bias     ;entry to dos for calls
 19      1880 =           bdose    equ     1880h+bias    ;end of dos load
 20      1600 =           boot     equ     1600h+bias    ;cold start entry point
 21      1603 =           rboot    equ     boot+3        ;warm start entry point
 22                       ;
 23      3000                      org     03000h        ;loaded down from hardware boot at 3000H
 24                       ;
 25      1880 =           bdosl    equ     bdose-cpmb
 26      0002 =           ntrks    equ     2             ;number of tracks to read
 27      0031 =           bdoss    equ     bdosl/128     ;number of sectors in dos
 28      0019 =           bdoso    equ     25            ;number of bdos sectors on track 0
 29      0018 =           bdos1    equ     bdoss-bdoso   ;number of sectors on track 1
 30                       ;
 31      f800 =           mon80    equ     0f800h        ;intel monitor base
 32      ff0f =           rmon80   equ     0ff0fh        ;restart location for mon80
 33      0078 =           base     equ     078h          ;'base' used by controller
 34      0079 =           rtype    equ     base+1        ;result type
 35      007b =           rbyte    equ     base+3        ;result byte
 36      007f =           reset    equ     base+7        ;reset controller
 37                       ;
 38      0078 =           dstat    equ     base          ;disk status port
 39      0079 =           ilow     equ     base+1        ;low iopb address
 40      007a =           ihigh    equ     base+2        ;high iopb address
 41      00ff =           bsw      equ     0ffh          ;boot switch
 42      0003 =           recal    equ     3h            ;recalibrate selected drive
 43      0004 =           readf    equ     4h            ;disk read function
 44      0100 =           stack    equ     100h          ;use end of boot for stack
 45                       ;
 46                       rstart:
 47      3000 310001               lxi     sp,stack;     ;in case of call to mon80
 48                       ;        clear disk status
 49      3003 db79                 in      rtype
 50      3005 db7b                 in      rbyte
 51                       ;        check if boot switch if off
 52                       coldstart:
 53      3007 dbff                 in      bsw
 54      3009 e602                 ani     02h           ;switch on?
 55      300b c20730               jnz     coldstart
 56                       ;        clear the controller
 57      300e d37f                 out     reset         ;logic cleared
 58                       ;
 59                       ;
 60      3010 0602                 mvi     b,ntrks       ;number of tracks to read
 61      3012 214230               lxi     h,iopbo
 62                       ;
 63                       start:
 64                       ;
 65                       ;        read first/next track into cpmb
 66      3015 7d                   mov     a,l
 67      3016 d379                 out     ilow
 68      3018 7c                   mov     a,h
 69      3019 d37a                 out     ihigh
 70      301b db78        waito:   in      dstat
 71      301d e604                 ani     4
 72      301f ca1b30               jz      waito
 73                       ;
 74                       ;        check disk status
 75      3022 db79                 in      rtype
 76      3024 e603                 ani     11b
 77      3026 fe02                 cpi     2
 78                       ;
 79                                if      testing
 80                                cnc     rmon80    ;go to monitor if 11 or 10
 81                                endif
 82                                if      not testing
 83      3028 d20030               jnc     rstart    ;retry the load
 84                                endif
 85                       ;
 86      302b db7b                 in      rbyte     ;i/o complete, check status
 87                       ;        if not ready, then go to mon80
 88      302d 17                   ral
 89      302e dc0fff               cc      rmon80    ;not ready bit set
 90      3031 1f                   rar               ;restore
 91      3032 e61e                 ani     11110b    ;overrun/addr err/seek/crc/xxxx
 92                       ;
 93                                if      testing
 94                                cnz     rmon80    ;go to monitor
 95                                endif
 96                                if      not testing
 97      3034 c20030               jnz     rstart    ;retry the load
 98                                endif
 99                       ;
100                       ;
101      3037 110700               lxi     d,iopbl   ;length of iopb
102      303a 19                   dad     d         ;addressing next iopb
103      303b 05                   dcr     b         ;count down tracks
104      303c c21530               jnz     start
105                       ;
106                       ;
107                       ;        jmp to boot to print initial message, and set up jmps
108      303f c30016               jmp     boot
109                       ;
110                       ;        parameter blocks
111      3042 80          iopbo:   db      80h       ;iocw, no update
112      3043 04                   db      readf     ;read function
113      3044 19                   db      bdoso     ;#sectors to read on track 0
114      3045 00                   db      0         ;track 0
115      3046 02                   db      2         ;start with sector 2 on track 0
116      3047 0000                 dw      cpmb      ;start at base of bdos
117      0007 =           iopbl    equ     $-iopbo
118                       ;
119      3049 80          iopb1:   db      80h
120      304a 04                   db      readf
121      304b 18                   db      bdos1     ;sectors to read on track 1
122      304c 01                   db      1         ;track 1
123      304d 01                   db      1         ;sector 1
124      304e 800c                 dw      cmpb+bdos0*128;base of second read
125                       ;
126      3050                      end


base              0078           33#     34      35      36      38   39   40
bdos              0806           18#
bdoso             0019           28#     29     113     124
bdos1             0018           29#    121
bdose             1880           19#     25
bdosl             1880           25#     27
bdoss             0031           27#     29
bias              0000           12#     15#     17      18      19   20
boot              1600           20#     21     108
bsw               00ff           41#     53
coldstart         3007           52#     55
cpmb              0000           17#     25     116     124
dstat             0078           38#     70
false             0000            7#      8       9
ihigh             007a           40#     69
ilow              0079           39#     67
iopbo             3042           61     111#    117
iopb1             3049          119#
iopbl             0007          101     117#
mon80             f800           31#
ntrks             0002           26#     60
rboot             1603           21#    
rbyte             007b           35#     50      86
readf             0004           43#    112     120
recal             0003           42#
reset             007f           36#     57
rmon80            ff0f           32#     80      89      94
rstart            3000           46#     83      97
rtype             0079           34#     49      75
stack             0100           44#     47
start             3015           63#    104
testing           0000            9#     11      14      79      82   93   96
true              ffff            8#  
waito             301b           70#     72

.nx appe
